package com.chr.hongyun.controller;


import com.chr.hongyun.common.utils.R;
import com.chr.hongyun.controller.form.TestSayHelloForm;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 测试管理控制层
 * 创建日期:2023/4/7
 * 创建人:陈浩然
 */
@RestController
@RequestMapping("/test")
@Api("测试Web接口")
public class TestController {
    @PostMapping("/sayHello")
    @ApiOperation("最简单的测试方法")
    public R sayHello(@Valid @RequestBody TestSayHelloForm form) {
        return R.ok().put("message", "Hello," + form.getName());
    }

    @PostMapping("/addUser")
    @ApiOperation("添加员工")
    @RequiresPermissions(value = {"ROOT", "USER:INSERT"}, logical = Logical.OR)
    public R addUser() {
        return R.ok("员工添加成功");
    }
}
